<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户列表</title>
    <script src="js/vue.js"></script>
    <script src="js/axios.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
            list-style: none;
        }

        .table {
            width: 400px;
        }

        .table .item {
            float: left;
            width: 100px;
            height: 40px;
            text-align: center;
            line-height: 40px;
            background-color: black;
            color: burlywood;
        }
    </style>
</head>

<body>
    <div id="app">
        <div class="table">
            <div class="tr">
                <div class="item">编号</div>
                <div class="item">用户名</div>
                <div class="item">密码</div>
                <div class="item">操作</div>
            </div>
            <div class="tr" v-for="item in list">
                <div class="item">{{item.id}}</div>
                <div class="item">{{item.username}}</div>
                <div class="item">{{item.userpwd}}</div>
                <div class="item">删除</div>
            </div>
        </div>

    </div>
</body>
<script>
    new Vue({
        el: "#app",
        data: {
            list: [],//声明数据的格式  是一个集合
        },
        async created() {//里面可以进行数据请求

            let {data:list} = await axios({ // {data:list}解构
                method: "get",//表示是get请求
                url: "http://localhost:2346/userinfos",
                params: {},//参数
            })
            //1:看network 判断是否有请求
            //2:输出请求的结果
            // console.log(res);
            //3:赋值给this  在看vue中数据
            this.list = list;
            //4:把数据渲染到页面


        }

    })


</script>

</html>